Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait pty readable if there may be data to read #23

Closed
wants to merge 1 commit into from

Conversation

YO4
Copy link

@YO4 YO4 commented Sep 25, 2024

Wait pty readable after pty write to keep vterm query/response order and to avoid early close.

fixes #22

@@ -89,7 +92,10 @@ def close
private def sync(wait = @wait)
sync_until = Time.now + @timeout
while @pty_output.wait_readable(wait)
vterm_write(@pty_output.read_nonblock(65536))
@pty_output.wait_readable(sync_until - Time.now) if @maybe_read
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pty_output.wait_readable(sync_until - Time.now) seems to have no effect.
This code is inside while @pty_output.wait_readable(wait) so @pty_output is already readable.

@tompng
Copy link
Member

tompng commented Sep 28, 2024

Thank you for investigating.
I'm closing this because early close and flaky test will be fixed in #24 with another approach. Early close will be removed from test and also from README example.

For query/response order, as described in #22 (comment), I think it is acceptable, and I also think it is hard to fix. (Sorry if my understanding is wrong.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to wait for pty response well
2 participants